'use strict';
/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, jwt } = app;
  router.redirect('/', '/swagger-ui.html', 302);
  router.post('/api/user/login', controller.sys.user.login);
  //#region 
  /*   router.get('/api/user/info', jwt, controller.sys.user.getCurUserInfo);

  router.post('/api/change/psw', jwt, controller.sys.user.changePsw);
  router.post('/api/reset/psw', jwt, controller.sys.user.resetPsw);

  router.post('/api/file', controller.sys.file.upload);

  router.get('/api/user/page', jwt, controller.sys.user.page);
  router.post('/api/user/create', jwt, controller.sys.user.create);
  router.post('/api/user/update', jwt, controller.sys.user.update);
  router.post('/api/user/delete', jwt, controller.sys.user.delete);

  router.get('/api/role/query', jwt, controller.sys.role.query);
  router.get('/api/role/page', jwt, controller.sys.role.page);
  router.post('/api/role/create', jwt, controller.sys.role.create);
  router.post('/api/role/update', jwt, controller.sys.role.update);
  router.post('/api/role/delete', jwt, controller.sys.role.delete);

  // 查询所有菜单
  router.get('/api/menu/query/tree', jwt, controller.sys.menu.queryTree);
  // 添加菜单
  router.post('/api/menu/create', jwt, controller.sys.menu.create);
  // 修改菜单
  router.post('/api/menu/update', jwt, controller.sys.menu.update);
  // 删除菜单
  router.post('/api/menu/delete', jwt, controller.sys.menu.delete);
  // 更新角色菜单
  router.post('/api/role/menu/update', jwt, controller.sys.menu.setRoleMenu);
  // 根据角色id查询菜单
  router.get('/api/role/menu', jwt, controller.sys.menu.getRoleMenu);
  // 获取当前用户菜单
  router.get('/api/user/menu', jwt, controller.sys.menu.getCurUserMenu);

  // 通过角色获取对应的用户
  router.get('/api/users/by/role', jwt, controller.sys.user.getUsersByRole); */
  //#endregion

  /* 顾客相关接口 */
  // 添加客户

  router.post('/customer/addCustomer', controller.customer.customer.addCustomer);
  // 添加新的联系人
  router.post('/customer/addContact', controller.customer.customer.addContact);
  // 新增追踪记录
  router.post('/customer/addTrack', controller.customer.customer.addTrack);
  // 发起用户申请
  router.post('/customer/addExamine', controller.customer.customer.addExamine);
  // 通过名字查找顾客
  router.get('/customer/checkCustomer', controller.customer.customer.checkCustomer);
  // 获取潜在客户列表
  router.get('/customer/getLatentList', controller.customer.customer.getLatentCustomerList);
  // 编辑顾客
  router.post('/customer/editCustomer', controller.customer.customer.editCustomer);
  // 编辑联系人
  router.post('/customer/editContact', controller.customer.customer.editContact);
  // 转移客户
  router.post('/customer/transferCustomer', controller.customer.customer.transferCustomer);
  // 删除联系人
  router.get('/customer/deleteContact', controller.customer.customer.deleteContact);
  // 删除跟踪记录
  router.get('/customer/deleteTrack', controller.customer.customer.deleteTrack);

  /* 合同相关接口  */
  // 预领合同申请
  router.post('/contract/addApplication', controller.contract.contract.addApplication);
  // 审核申请单
  router.post('/contract/examineApplication', controller.contract.contract.editApplication);
  // 顾客付款
  router.post('/contract/addPay', controller.contract.contract.addPay);
  // 细化合同内容(新建)
  router.post('/contract/detailContract', controller.contract.contract.detailContract);
  // 审核合同
  router.post('/contract/examineContract', controller.contract.contract.examineContract);
  // 获得合同列表
  router.get('/contract/getContractList', controller.contract.contract.getContractList);

  /* 财务中心相关接口 */
  // 增加合同收入
  router.post('/finance/addIncome', controller.finance.finance.addIncome);
  // 增加支出记录
  router.post('/finance/addExpense', controller.finance.finance.addExpense);
  // 审核收入记录
  router.post('/finance/examineIncome', controller.finance.finance.examineIncome);
  // 审核支出记录
  router.post('/finance/examineExpense', controller.finance.finance.examineExpense);
  // 根据状态查询收入列表
  router.get('/finance/findIncomeListByState', controller.finance.finance.findIncomeListByState);
  // 查询待审核收入列表
  router.get('/finance/findNewIncomeList', controller.finance.finance.findNewIncomeList);
  // 查询已审核收入列表
  router.get('/finance/FindExaminedIncomeList', controller.finance.finance.FindExaminedIncomeList);
  // 查询待审核支出记录
  router.get('/finance/findNewExpenseList', controller.finance.finance.findNewExpenseList);
  // 查询已审核支出记录
  router.get('/finance/findExamineExpenseList', controller.finance.finance.findExamineExpenseList);
};

